version 17.0

******************************************************************************
/*																			*/
/*		Filename: ELS Analysis												*/
/*		Authors: Abigail Matthews & Jason Rantanen					 		*/
/*		Purpose: Analysis for "Legal Research As A Collective Enterprise"	*/
/*																			*/
******************************************************************************


/* To make tables, may need to install estout program. */ 
*ssc install estout


use "ELS-SS_data.dta", clear

**# how many articles?
tab discipline Final_Article

**#how many empirical studies?
tab discipline Final_Empirical, row 
tab discipline Final_Empirical if Year>=2018, row 

*keep only empirical articles
keep if Final_Article==3
keep if Final_Empirical==3

**# How many law journals make their data available?
tab avail if discipline==1 
tab avail if discipline==1 & Year>=2018

**# FIGURE 1 Number of Empirical Articles by Year
graph bar (count) Final_Empirical if discipline==1, over(Year)  ytitle(Count of Empirical Articles)  graphregion(lcolor(black) lwidth(none)) graphregion(fcolor(white)) scheme(s1mono) plotregion(lwidth(none)) intensity(75) b1title(Year Published) ylabel(0(15)90)
	graph save "Graph" "NoEmpiricalArticlesbyYear2.gph", replace
	graph export "NoEmpiricalArticlesbyYear2.pdf", replace
	
****************************************
**#Summary Statistics on Data Availability

* Location Where Data Stored
tab datalocation1 if discipline==1


*Article's subject matter
tab subject1 /* Note this is only for 2010-2019 */

****************************************
* Data Availability Hypotheses
****************************************

**# Table 1: LPM Model, Factors Influencing Availability Law Reviews 2018-2022

regress avail qualitative coauthor phd ib(0).DataPolicy peerreview ib(2018).Year DataPolicy#ib(2018).Year if discipline==1 & Year>=2018, cluster(PublicationName) robust
estimates store avail

estout avail using table1.txt, cells(b(star fmt(2)) se(par)) stats(N) starlevels(* 0.05 ** 0.01 *** 0.001) varlabels(qualitative Qualitative summarystats SummaryStatistics  coauthor Coauthored peerReview "Peer Reviewed" Year "Year Article Published" _cons Constant) legend label collabels(none) replace


**# Table 2: LPM Model, Factors Influencing Availability for All Disciplines
regress avail coauthor ib(0).DataPolicy Year i.discipline if Year>=2018, cluster(PublicationName) robust
estimates store avail2

estout avail2 using table2.txt, cells(b(star fmt(2)) se(par)) stats(N) starlevels(* 0.05 ** 0.01 *** 0.001) varlabels(coauthor Coauthored Year "Year Article Published" _cons Constant) legend label collabels(none) replace

**# Contact Author
tab authordata if authordata !=2 & discipline==1
tab authordata if authordata !=2 & discipline==1 & Year>=2018

tab discipline avail, row


***********************
**# Disciplinary Norms: unit of anlaysis, author
use full_authors_list.dta, clear


bysort name: gen lawavail = availcountlaw/availtotallaw
bysort name: gen SSavail = availcountSS/availtotalSS
bysort name: gen intavail = availcountint/availtotalint

egen total = rowtotal(availtotallaw availtotalSS availtotalint)
egen availtotal = rowtotal(availcountlaw availcountSS availcountint)
bysort name: gen availrank = availtotal/total

replace discipline1 = 0 if discipline1==.
replace discipline2 = 0 if discipline2==.
replace discipline3 = 0 if discipline3==.


tab availrank
sum availrank, det

*********************
**# Table 3: Data Policies, author-article unit of analysis

use "author_article_unitofA.dta", clear

tab avail DataPolicy, chi col


************************************
		/*  APPENDIX.  */
************************************

use "ELS-SS_data.dta", clear

*keep only empirical articles
keep if Final_Article==3
keep if Final_Empirical==3


**# Appendix Table 1 Type of Empirical Work in Student-Edited Law Journals */
	tab qualitative if discipline==1
	tab summarystats if discipline==1
	tab statisticalanalysis if discipline==1

	
**# Appendix Table 2 Chi-Square Tests for Student-Edited Law Journals */

* Qualitative Availability
	tab avail qualitative if discipline==1 & Year>=2018, chi2  column

* Summary Statistics Availability
	tab avail summarystats if discipline==1 & Year>=2018, chi2  column

* Coauthor Availability
	tab  avail coauthor if discipline==1 & Year>=2018, chi2 column

* PhD Availability
	tab  avail phd if discipline==1 & Year>=2018, chi2 column
	
* Data Policy Availability
	tab avail DataPolicy if discipline==1 & Year>=2018, chi2 column
	
* Peer Review Availability
	tab avail peerreview if discipline==1 & Year>=2018, chi2 col

	
**# Appendix Figure 1 Availability Over Time

	*Denominator
	bysort Year: egen availcountyeartotal = count(avail) if discipline==1
	*Numerator
	bysort Year: egen availcount = count(avail) if discipline==1 & avail==1
	*Fraction for Graph
	gen percentavail = . 
	bysort Year: replace percentavail = availcount/availcountyeartotal if avail==1
	replace percentavail = percentavail*100
		
graph bar (median) percentavail, over(Year) ytitle(Percent)  graphregion(lcolor(black) lwidth(none)) graphregion(fcolor(white)) scheme(s1mono) plotregion(lwidth(none)) intensity(75) saving("Year Availability bar graph.gph", replace)
	graph export "Year Availability bar graph.pdf", replace
	

*********************
**# Appendix Table A3: Data Policies, author-article unit of analysis

use "author_article_unitofA.dta", clear

regress avail coauthor ib(0).DataPolicy Year, cluster(name) robust
estimates store avail3

estout avail3 using tableA3.txt, cells(b(star fmt(2)) se(par)) stats(N) starlevels(* 0.05 ** 0.01 *** 0.001) varlabels(Year Year coauthor "Coauthored Article" _cons Constant) legend label collabels(none) replace
